#include <iostream>
#include <string>
#include <fstream>

using namespace std;

int main(int argc, char* argv[]) {
	string fileName(argv[1]);
	ifstream in(fileName.c_str());	
	if(!in) {
		cerr << "can not open file" << endl;
		return 0;
	}
	ofstream out((fileName + "_copy").c_str(), ios::binary);
	string line;
	int count = 1;
	while(in) {
		getline(in, line);	
		cout << count << " :" << line;//without newline 
		out << line;
		if(in.eof()) {cerr << "reached EOF \n"; break;}
		cout << endl;	
		out << endl;
		++count;
		//in.getline(buf,100);
		//cout ii<< count << " :" << buf << endl;
	}
}
